﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BDS3M
{
    public partial class _404 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string url = HttpContext.Current.Request.Url.Query.ToString();

            // HttpContext.Current.Server.Transfer("ViewGroupProduct.aspx?catID=1");
            string[] urlInfo404 = Request.Url.Query.ToString().Split(';');

            if (urlInfo404.Length > 1)
            {
                string requestURL = urlInfo404[1].Replace("http://", "");

                if (requestURL.Contains("www"))
                    requestURL = requestURL.Replace("www.thailong.info:8084/", "");
                else
                    requestURL = requestURL.Replace("thailong.info:8084/", "");


                requestURL = LIB.RewriteURL.getRealUrl(requestURL, Server.MapPath("RewriteUrl.xml"));

                if (requestURL == "error")

                    HttpContext.Current.Server.Transfer("/Error.aspx");

                else

                    HttpContext.Current.Server.Transfer("/" + requestURL);

            }

            HttpContext.Current.Server.Transfer("/home");
        }
    }
}